package org.luxor.commons.core.constant;

/**
 * 过滤器顺序定义
 *
 * @author Mr.yan @date 2023/11/25
 */
public enum FilterOrdered {

    LOWEST_PRECEDENCE(Integer.MIN_VALUE, "最高优先级值"),

    CHARACTER_ENCODING_FILTER_PRECEDENCE(Integer.MIN_VALUE, "characterEncodingFilter"),
    WEB_MVC_METRICS_FILTER_PRECEDENCE(Integer.MIN_VALUE + 1, "webMvcMetricsFilter"),
    REQUEST_LOG_FILTER_PRECEDENCE(Integer.MIN_VALUE + 2, "requestLogFilter"),
    SIGNATURE_FILTER_PRECEDENCE(Integer.MIN_VALUE + 3, "signatureFilter"),

    HIDDEN_HTTP_METHOD_FILTER_PRECEDENCE(-10000, "hiddenHttpMethodFilter"),
    HTTP_PUT_FORM_CONTENT_FILTER_PRECEDENCE(-9900, "httpPutFormContentFilter"),
    REQUEST_CONTEXT_FILTER_FILTER_PRECEDENCE(-105, "requestContextFilter"),

    XSS_FILTER_PRECEDENCE(-101, "xssFilter"),
    SECURITY_FILTER_PRECEDENCE(-100, "springSecurityFilterChain"),

    HTTP_TRACE_FILTER_PRECEDENCE(Integer.MAX_VALUE - 10, "HttpTraceFilter"),
    HIGHEST_PRECEDENCE_PRECEDENCE(Integer.MAX_VALUE, "最低优先级值");
    private final int order;
    private final String describe;

    FilterOrdered(int order, String describe) {
        this.order = order;
        this.describe = describe;
    }

    public int getOrder() {
        return order;
    }

    public String getDescribe() {
        return describe;
    }

    @Override
    public String toString() {
        return "FilterOrders{" +
                "order=" + order +
                ", describe='" + describe + '\'' +
                '}';
    }
}
